import React from 'react';
import ReactDOM from 'react-dom';
//import axios from 'axios'
import {createStore, applyMiddleware, compose} from 'redux'
import thunk from 'redux-thunk'
//import './index.css'; import App from './App';
import registerServiceWorker from './registerServiceWorker';
import {Provider} from 'react-redux'
import {BrowserRouter, Route, Link, Redirect, Switch} from 'react-router-dom'

import {Pagination} from 'antd';

import './config'
import './index.css'

import AuthRoute from './component/authroute/authroute'
import Login from './container/login/login'
import Register from './container/register/register'
import BossInfo from './container/bossinfo/bossinfo'
import GeniusInfo from './container/geniusinfo/geniusinfo'
import Dashboard from './component/dashboard/dashboard'
import Chat from './component/chat/chat'

import reducers from './reducer'

const store = createStore(reducers, compose(applyMiddleware(thunk), window.devToolsExtension
    ? window.devToolsExtension()
    : f => f))

ReactDOM.render((

    <Provider store={store}>

        <BrowserRouter>

            <div>
                <AuthRoute></AuthRoute>
                <Switch>
                    
                    <Route path='/geniusinfo' component={GeniusInfo}></Route>
                    <Route path='/bossinfo' component={BossInfo}></Route>
                    {/* <Route path='/boss' component={Boss}></Route> */}
                    {/* <Route path='/' component={Login}></Route> */}
                    <Route path='/login' component={Login}></Route>
                    {/* <Redirect from="/" to="/login"></Redirect>   */}
                    <Route path='/register' component={Register}></Route>
                    <Route path='/chat/:user' component={Chat}></Route>
                    {/* <Route path='/' component={Login}></Route> */}
                    <Route component={Dashboard}></Route>
                    {/* <Route path='/' component={Login}></Route> */}
                </Switch>
            </div>
        </BrowserRouter>
    </Provider>

), document.getElementById('root'))

registerServiceWorker();